#!/usr/bin/python
# -*- coding: utf-8 -*-


import base64
import hashlib
import os
import logging
import random
import string
import json
import re
import math
import time


def get_file_md5(fname):
    hash_md5 = hashlib.md5()
    with open(fname, "rb") as f:
        for chunk in iter(lambda: f.read(4096), b""):
            hash_md5.update(chunk)
    return hash_md5.hexdigest()


def get_file_sha_1(fname):
    hash_sha_1 = hashlib.sha1()
    with open(fname, "rb") as f:
        for chunk in iter(lambda: f.read(4096), b""):
            hash_sha_1.update(chunk)
    return hash_sha_1.hexdigest()

def get_FileSize(filePath):
    filePath = unicode(filePath, 'utf8')
    return os.path.getsize(filePath)